<%-- 
    Document   : listBoard.jsp
    Created on : 2012. 4. 20, 오후 3:32:27
    Author     : jeong
--%>

<%@page import="com.webproject.jsp.board.model.Board"%>
<%@page import="java.util.List"%>
<%@page import="com.webproject.jsp.board.BoardManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%

    BoardManager bm = BoardManager.getInstance();
    List list = bm.getBoardList();
    
%>
<script language="javascript">
    
    $(document).ready(function() {
        
        $('#moveForm').click(function(){
           location.href = "/webproj/board/insertBoardForm.jsp";
           
        });
    });
    
    /*--
    function onMoveForm() {
        
        //$('#saveForm').click(function(){
           document.location.href = "/webproj/board/insertBoardForm.jsp";
           
        //});
    }
    --*/

    function goSelectedNum(no) {
        
        var frm = $('form#frm');
        $('#selectedNum').val(no);
        
        var url = "/webproj/board/selectBoardView.jsp";
        $('form#frm').attr("action",url);
            
        frm.submit(); 
    }
</script>
<form name="frm" id="frm" method="POST">
<input type="hidden" name="selectedNum" id="selectedNum" value=""/>
<div>
    <table>
        <tr>
            <td colspan="8">&nbsp;</td>
        </tr>
        <tr>
            <td><input type="checkbox" name="checkAll" id="checkAll"/><td>No</td><td>&nbsp;</td><td>제목</td><td>&nbsp;</td><td>작성자</td><td>&nbsp;</td><td>작성일</td>
        </tr>
        <tr>
            <td colspan="8">&nbsp;</td>
        </tr>        
    </table>
    <table>
<%
    if(list != null) {
        for(int i=0; i < list.size(); i++) {
            Board board = (Board)list.get(i);
            
%>       
        <tr style="cursor:hand" onclick="goSelectedNum(<%=board.getNo()%>)" onmouseover="this.style.backgroundColor='#EEEEEE'" onmouseout="this.style.backgroundColor=''">
            <td><input type="checkbox" name="chkbox" id="chkbox" value="<%=board.getNo()%>"/></td><td><%=i+1%></td><td>&nbsp;</td><td><%=board.getTitle()%></td><td>&nbsp;</td><td><%=board.getRegUserId()%></td><td>&nbsp;</td><td><%=board.getRegDate()%></td>
        </tr>
<%
       }
    } else {
%>
        <tr>
            <td colspan="8"><center>작성한 데이타가 없습니다.</center></td>
        </tr>       
<%
   }
%>
    </table>
    <table cellspacing="1" cellpadding="1" border="0" align="center">
        <tr>
            <td align="center"><input type="button" name="moveForm" id="moveForm" value="작성"/></td>
        </tr>
    </table>
</div>
</form>